import { setToken, getToken, removeToken } from '@/utils/storage'

export default {
  namespaced: true, // 打开命名空间
  state: () => ({

    token: getToken() // 获取用户名

  }),

  mutations: {

    setToken (state, obj) {
      state.token = obj
      setToken(obj)
    },
    clearToken (state) {
      removeToken() // 调用删除方法
    }

  },
  actions: {

  },
  getters: {
    tokens: state => state.token // 通过getter暴露数据

  }

}
